home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # messages: part of the Elm mail system
- # @(#)$Id: messages.SH,v 5.2 1992/10/17 22:38:58 syd Exp $
- # Copyright (c) 1988-1992 USENET Community Trust
- # Copyright (c) 1986,1987 Dave Taylor
-
- if [ "$2" != "" ]; then
- echo Usage: messages \{folder-name\} 1>&2
- exit 1
- fi
-
- if [ "$1" = "" ]; then
- fname=${MAIL-/usr/spool/mail/$LOGNAME}
- optional="in your incoming mailbox"
- else
- optional="in folder $1"
- first=`expr "$1" : "\(.\).*"`
- if [ "$first" = "=" ]; then
- last=`expr "$1" : ".\(.*\)"`
- fname="`grep maildir $HOME/.elm/elmrc | awk -F= '{print $2}'| tr -d ' '`/$last"
- else
- fname=$1
- fi
- fi
-
- if [ -f "$fname" ]; then
- mcount=`egrep -c "^From " $fname`
- else
- echo "Folder $1 does not exist."
- exit 0
- fi
-
- if [ "$mcount" -eq 1 ]; then
- echo There is 1 message $optional.
- elif [ "$mcount" -eq 0 ]; then
- echo There are no messages $optional.
- else
- echo There are $mcount messages $optional.
- fi
-
- exit $mcount
-